﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Chat</title>
  <script type="text/javascript" src="jquery-1.7.2.min.js"></script>
  <script type="text/javascript">

    function refresh() {
        $.ajax({ type: "GET", url: "/gethistory", dataType: "text",
        success: function (data) {
          $("#output").html(data);
        }
      });
    };

    function send() {
        $.ajax({ type: "POST", url: "/append", dataType: "text", 
          data: $("#textBox").val(), success: refresh });
      $("#textBox").val("");
    }

    setInterval(function () { refresh(); return true; }, 500);

  </script>
  <link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
  <div id="page">
    <h1>Agent-based F# chat</h1>
    <div id="output"></div>
    <div id="input">
    <input type="text" id="textBox" />
    <button onclick="send();">Send</button>
    </div>
  </div>
</body>
</html>